package com.corpgovernment.organization.service;

import com.corpgovernment.api.organization.model.idcard.MbOrgUserIdcardDto;
import com.corpgovernment.api.organization.model.idcard.UserIdCardVo;
import com.corpgovernment.organization.entity.db.MbOrgUserIdcard;

import java.util.List;

/**
 * 证件信息service
 *
 * @author wangyujue
 */
public interface IOrgUserIdCardService {


	/**
	 * 创建
	 *
	 * @param mbOrgUserIdcard
	 * @return
	 */
	boolean create(MbOrgUserIdcard mbOrgUserIdcard);

	/**
	 * 更新
	 *
	 * @param mbOrgUserIdcard
	 * @return
	 */
	boolean updateEmployeeCard(MbOrgUserIdcard mbOrgUserIdcard);

	boolean update(MbOrgUserIdcard mbOrgUserIdcard);

    /**
     * 查询用户证件信息
     *
     * @param employeeUid
     * @return
     */
    List<MbOrgUserIdcard> findByEmployeeUid(String employeeUid);

    /**
     * 删除证件信息
     *
     * @param id
     * @return
     */
    boolean delete(Integer id);

    /**
     * 通过员工uid删除用户证件
     *
     * @param uid
     * @return
     */
    boolean deleteByEmployeeUid(String uid);

    /**
     * 删除非员工证件
     *
     * @param nonEmployeeUid
     * @return
     */
    boolean deleteByNonEmployeeUid(Long nonEmployeeUid);

    /**
     * 根据员工id和证件类型
     *
     * @param uid      用户id
     * @param cardType 证件类型
     * @return 证件信息
     */
    MbOrgUserIdcard findByEmployeeUidAndType(String uid, Integer cardType);

    /**
     * 根据非员工id和证件类型
     *
     * @param nonEmployeeUid 非员工id
     * @param cardType       证件类型
     * @return 证件信息
     */
    MbOrgUserIdcard findByNonEmployeeUidAndType(Long nonEmployeeUid, Integer cardType);

    /**
     * 批量查询用户证件信息
     *
     * @param uids
     * @return
     */
    List<MbOrgUserIdcard> batchFindByUids(List<String> uids);

    /**
     * 批量查询非员工证件信息
     *
     * @param nonEmployeeUids
     * @return
     */
    List<MbOrgUserIdcard> batchFindByNonEmployeeUids(List<Long> nonEmployeeUids);

    /**
     * 批量保存
     *
     * @param needAddList
     * @return
     */
    boolean batchSave(List<MbOrgUserIdcard> needAddList);

    /**
     * 修改非员工证件
     *
     * @param mbOrgUserIdcard
     * @return
     */
    boolean updateNonEmployeeCard(MbOrgUserIdcard mbOrgUserIdcard);

    MbOrgUserIdcardDto selectCardInfo(Integer cardType, String cardNo);

    List<MbOrgUserIdcard> listEmployeeByTypeAndNo(Integer type, String cardNo);

	List<MbOrgUserIdcard> listByNo(String cardNo);

	/**
	 * 保存单个证件信息
	 *
	 * @param mbOrgUserIdcard
	 * @return
	 */
	boolean save(MbOrgUserIdcard mbOrgUserIdcard);

	boolean saveList(List<MbOrgUserIdcard> mbOrgUserIdCardList);

	/**
	 * 根据type和no查询证件
	 *
	 * @param type
	 * @param cardNo
	 * @return
	 */
	List<MbOrgUserIdcard> findByTypeAndNo(Integer type, String cardNo);

	/**
	 * 根据type和no查询证件
	 *
	 * @param userIdCardVo
	 * @return
	 */
	boolean validateCardInfo(UserIdCardVo userIdCardVo);

	/**
	 * 查询证件信息-查询进行内部｜外部员工证件隔离
	 * @param type 证件类型
	 * @param cardNo 证件号码
	 * @param nonEmployee true：外部员工 false：内部员工
	 * @return
	 */
	List<MbOrgUserIdcard> findByTypeAndNo(Integer type, String cardNo, boolean nonEmployee);

	/**
	 * 根据证件号模糊搜索
	 *
	 * @param cardNo
	 * @return
	 */
	List<MbOrgUserIdcard> getLikeCardNo(String cardNo);

	/**
	 * 根据用户id查询
	 *
	 * @param uids
	 * @return
	 */
	List<MbOrgUserIdcard> getByUids(List<String> uids);

	boolean deleteByUids(List<String> uids);

	boolean insertList(List<MbOrgUserIdcard> mbOrgUserIdcardList);

    /**
     * 根据list批量删除
     * @param mbOrgUserIdCardList
     * @return
     */
	boolean deleteByList(List<MbOrgUserIdcard> mbOrgUserIdCardList);

    /**
     * 根据非员工id查询
     * @param id
     * @return
     */
	List<MbOrgUserIdcard> findByNonEmployeeId(Long id);
}
